package ee.ut.veebirakendus.model;

import java.util.Collections;
import java.util.Stack;

public class Deck {

	private Stack<Card> cardDeck;

	public void createDeck() {
		if (cardDeck == null) {
			cardDeck = new Stack<Card>();
		}
		cardDeck.clear();
		for (Suit suit : Suit.values()) {
			for (Rank rank : Rank.values()) {
				cardDeck.push(new Card(suit, rank));
			}
		}
		Collections.shuffle(cardDeck);
	}

	public Card getNextCard() {
		return cardDeck.pop();
	}
}
